﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Data;
using System.Data.SqlClient;
using GeneralLibs;
using System.Collections.Generic;

namespace ReportTemplates.Clinic
{
    public partial class XtraReportBangKeThue : DevExpress.XtraReports.UI.XtraReport
    {
        public XtraReportBangKeThue()
        {
            InitializeComponent();
        }

        private void XtraReport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            //DataSet ds = new ReportTemplates.Clinic.DsClinicChung();
            //try
            //{
            //    SqlConnection con = new SqlConnection(GeneralLibs.LocalSettings.ConnectString);
            //    SqlCommand cmd = con.CreateCommand();
            //    SqlDataAdapter da = null; ;

            //    cmd.CommandText = "Select_ThongTinDoanhNghiep2";
            //    cmd.CommandType = CommandType.StoredProcedure;
            //    da = new SqlDataAdapter(cmd);
            //    da.Fill(ds, "ThongTinDoanhNghiep");

            //    cmd.CommandType = CommandType.StoredProcedure;
            //    cmd.CommandText = "Select_ChiTietKhoanMucPhieuChiDinh";
            //    cmd.Parameters.Clear();
            //    cmd.Parameters.AddWithValue("@PhieuChiDinhID", "851739d7-e107-e611-87c9-00214ffc5a14");
            //    da.Fill(ds, "ChiTietPhieuChiDinh");

            //    cmd.CommandText = "Select_MasterPhieuChiDinh";
            //    cmd.Parameters.Clear();
            //    cmd.Parameters.AddWithValue("@PhieuChiDinhID", "851739d7-e107-e611-87c9-00214ffc5a14");
            //    da.Fill(ds, "Master_PhieuChiDinh");

            //    con.Close();

            //    //Chèn logo nếu có
            //    if (DanhMucLogo.GetFirst() != null && DanhMucLogo.GetFirst().AnhLogo != null)
            //    {
            //        ds.Tables["Logo"].Rows.Add(DanhMucLogo.GetFirst().AnhLogo);
            //    }

            //    //ReportTemplates.Clinic.PhieuChiDinh.RptPhieuChiDinh report = new ReportTemplates.Clinic.PhieuChiDinh.RptPhieuChiDinh();
            //    //report.SetDataSource(ds);
            //    //ReportTemplates.FrmPrintReport frm = new ReportTemplates.FrmPrintReport(report, "Phiếu chỉ định");
            //    //frm.Show();
            //}
            //catch (Exception ex)
            //{
            //}
            //this.DataSource = ds;
        }
    }
}
